import API from "../../library/axios/api";
export const methods = {
    login() {
        API.login.cellphone(this.data).then((res) => {
            console.log(res);
            if (res.code === 200) {
                localStorage.setItem('id', res.account.id);
                localStorage.setItem('uid', res.profile.userId);
                localStorage.setItem('token', JSON.stringify(res.token));
                this.setCookie('cookie', res.cookie, 86400);
                this.$router.push({
                    name: 'Recommendation',
                    params: {
                        nickname: res.profile.nickname,
                        avatarUrl: res.profile.avatarUrl,
                    }
                });

            }
        });
    },
    close() {
        this.$router.push({
            name: 'Recommendation',
        })
    }
}